package com.tzpay.tzpay.bean;

import android.os.Parcel;
import android.os.Parcelable;
import android.text.TextUtils;

import com.tzpay.tzpay.api.OrderCreate;
import com.tzpay.tzpay.api.OrderCreateRequest;
import com.tzpay.tzpay.api.OrderQuery;
import com.tzpay.tzpay.api.OrderRefundRequest;
import com.tzpay.tzpay.api.OrderReverseRequest;

public class OrderInfo implements Parcelable, Cloneable {

    public static final String UPLOAD_SUCCESS = "true";
    public static final String UPLOAD_FAILED = "false";

    //    n1	0代表为未退款，1 已退款2部分退款 3已冲正
    public static final String FLAG_REFUND = "0";
    public static final String FLAG_REFUNDED = "1";
    //    public static final String FLAG_REFUND_PART = "2";
    public static final String FLAG_REVERSE = "3";

    /**
     * 交易状态
     * A：请求（支付中）
     * B：成功（支付成功）
     * C：失败
     * G：订单作废
     */
    public static final String STATUS_PAYING = "A";
    public static final String STATUS_PAY_SUCCESS = "B";
    public static final String STATUS_PAY_FAILED = "C";
    public static final String STATUS_INVALID = "G";

    /**
     * 序号	类型缩写	类型描述	参考
     * 1	a	字母a－z	A、a、ab
     * 2	n	数字0－9	1、12、-1
     * 3	s	特殊字符	@、#
     * 4	an	字母和数字字符	Word2
     * 5	ans	字母、数字和特殊字符	Hell_wold1
     * 6	yyyy	4位数年份	2010（2010年）
     * 7	MM	年份中的月份	03（3月份）
     * 8	DD	月份中的日期	25（25号）
     * 9	hh	小时（24格式）	15（15点）
     * 10	mm	分钟	30（30分）
     * 11	ss	秒	59（59秒）
     * <p/>
     * 符号	含义
     * M	必须填写的域
     * O	可选的域
     */

    private int _id;

    /**
     * 订单号(30 由商户平台提供，数字或字母组成)
     */
    private String orderNo;

    /**
     * 交易流水号 (30 M 由商户平台提供，数字或字母组成)
     */
    private String orderReqNo;

    /**
     * 商户号(30	M	由翼支付网关平台统一分配)
     */
    private String merchantId;

    /**
     * 子商户号(30	O	由商户平台自己分配，在做支付时，
     * 可以一并发送过来，翼支付网关平台可以负责记录，如没有可以不填写)
     */
    private String subMerchantId;

    /**
     * 订单日期(yyyyMMddHHmmss)
     * 20	M	由商户提供，长度14位
     * 格式yyyyMMddhhmmss
     */
    private String orderDate;

    /**
     * 订单金额(10	M	单位：分
     * 订单总金额 = 产品金额+附加金额
     * )
     */
    private String orderAmt;

    /**
     * 产品金额 10	M	单位：分
     */
    private String productAmt;

    /**
     * 附加金额 10	M	单位：分
     */
    private String attachAmt;

    /**
     * 商品名称
     */
    private String goodsName;

    /**
     * 门店号 n 10	M	门店号
     */
    private String storeId;

    /**
     * 翼支付交易号(an	30	M	翼支付生成的内部流水号)
     * （用户支付后生成）
     */
    private String ourTransNo;

    /**
     * 错误码  当success为true时，为null，当success为false时，为错误码
     */
    private String errorCode;

    /**
     * 错误信息  当success为true时，为null，当success为false时，为错误描述
     */
    private String errorMsg;

    /**
     * 退款标志   n1	0代表为退款，1 已退款2部分退款 3已冲正
     */
    private String refundFlag;

    /**
     * 退款流水号
     * an	30	M	该流水在商户处必须是唯一的，而且每次发起退款时，都必须是唯一的
     */
    private String refundReqNo;

    /**
     * 退款请求日期
     * n	14	M	yyyyMMDD
     */
    private String refundReqDate;

    /**
     * 退款交易金额
     * n	12	M	单位为分，小于等于原订单金额
     * <p/>
     * <p/>
     * 冲正时为冲正金额
     */
    private String transAmt;

    /**
     * 交易状态
     * n1	M	A：请求（支付中）
     * B：成功（支付成功）
     * C：失败
     * G：订单作废
     */
    private String transStatus;


    /**
     * 签名方式	n	1	O	1代表MD5
     * 3代表RSA
     * 9代表CA
     * 默认为1
     */
    private String encodeType;

    /**
     * sign校验域	an	30	M
     */
    private String sign;
    /**
     * 客户支付手机号	n11	M	客户条码消费时的支付手机号，中间4位被隐去，用*代替
     * 如180****2687
     */
    private String customerId;

    private String barcode;

    private String channel;

    private String busiType;

    private String backUrl;

    private String ledgerDetail;

    /**
     * 临时数据
     */
    private String temp1, temp2, temp3, temp4, temp5, temp6, temp7, temp8, temp9, temp10;

    /**
     * 上传标志()
     */
    private String uploadFlag;

    public int get_id() {
        return _id;
    }

    public void set_id(int _id) {
        this._id = _id;
    }

    public String getOrderNo() {
        return orderNo;
    }

    public void setOrderNo(String orderNo) {
        this.orderNo = orderNo;
    }

    public String getOrderReqNo() {
        return orderReqNo;
    }

    public void setOrderReqNo(String orderReqNo) {
        this.orderReqNo = orderReqNo;
    }

    public String getMerchantId() {
        return merchantId;
    }

    public void setMerchantId(String merchantId) {
        this.merchantId = merchantId;
    }

    public String getSubMerchantId() {
        return subMerchantId;
    }

    public void setSubMerchantId(String subMerchantId) {
        this.subMerchantId = subMerchantId;
    }

    public String getOrderDate() {
        return orderDate;
    }

    public void setOrderDate(String orderDate) {
        this.orderDate = orderDate;
    }

    public String getOrderAmt() {
        return orderAmt;
    }

    public void setOrderAmt(String orderAmt) {
        this.orderAmt = orderAmt;
    }

    public String getProductAmt() {
        return productAmt;
    }

    public void setProductAmt(String productAmt) {
        this.productAmt = productAmt;
    }

    public String getAttachAmt() {
        return attachAmt;
    }

    public void setAttachAmt(String attachAmt) {
        this.attachAmt = attachAmt;
    }

    public String getGoodsName() {
        return goodsName;
    }

    public void setGoodsName(String goodsName) {
        this.goodsName = goodsName;
    }

    public String getStoreId() {
        return storeId;
    }

    public void setStoreId(String storeId) {
        this.storeId = storeId;
    }

    public String getOurTransNo() {
        return ourTransNo;
    }

    public void setOurTransNo(String ourTransNo) {
        this.ourTransNo = ourTransNo;
    }

    public String getErrorCode() {
        return errorCode;
    }

    public void setErrorCode(String errorCode) {
        this.errorCode = errorCode;
    }

    public String getErrorMsg() {
        return errorMsg;
    }

    public void setErrorMsg(String errorMsg) {
        this.errorMsg = errorMsg;
    }

    public String getRefundFlag() {
        return refundFlag;
    }

    public void setRefundFlag(String refundFlag) {
        this.refundFlag = refundFlag;
    }

    public String getRefundReqNo() {
        return refundReqNo;
    }

    public void setRefundReqNo(String refundReqNo) {
        this.refundReqNo = refundReqNo;
    }

    public String getRefundReqDate() {
        return refundReqDate;
    }

    public void setRefundReqDate(String refundReqDate) {
        this.refundReqDate = refundReqDate;
    }

    public String getTransAmt() {
        return transAmt;
    }

    public void setTransAmt(String transAmt) {
        this.transAmt = transAmt;
    }

    public String getTransStatus() {
        return transStatus;
    }

    public void setTransStatus(String transStatus) {
        this.transStatus = transStatus;
    }

    /**
     * 获取订单状态
     *
     * @return
     */
    public String getTradeStatus() {
        if (TextUtils.isEmpty(transStatus)) {
            return "";
        }
        String status = "";
        switch (transStatus) {
            case "A":
                status = "未支付";
                break;
            case "B":
                status = getRefundStatus();
                if (TextUtils.isEmpty(status)) {
                    status = "支付成功";
                }
                break;
            case "C":
                status = "支付失败";
                break;
            case "G":
//                status = "订单作废";
                status = "支付失败";
                break;
        }
        return status;
    }

    /**
     * 0代表为退款，1 已退款2部分退款 3已冲正
     *
     * @return
     */
    public String getRefundStatus() {
        if (TextUtils.isEmpty(refundFlag)) {
            return "";
        }
        String refundStatus = "";
        switch (refundFlag) {
            case "0":
                refundStatus = "交易成功";
                break;
            case "1":
                refundStatus = "已退款";
                break;
            case "2":
                refundStatus = "部分退款";
                break;
            case "3":
                refundStatus = "已退款";
                break;
        }
        return refundStatus;
    }

    public boolean getRefundStatusBoolean() {
        if (TextUtils.isEmpty(refundFlag)) {
            return true;
        }
        boolean refundStatus = false;
        switch (refundFlag) {
            case "0":
                refundStatus = true;
                break;
            case "1":
                refundStatus = false;
                break;
            case "2":
                refundStatus = false;
                break;
            case "3":
                refundStatus = false;
                break;
        }
        return refundStatus;
    }

    public boolean isCanRefund() {
        if (TextUtils.isEmpty(transStatus)) {
            return false;
        }
        boolean status = false;
        switch (transStatus) {
            case "A":
                status = false;
                break;
            case "B":
                status = getRefundStatusBoolean();
                break;
            case "C":
                status = false;
                break;
            case "G":
                status = false;
                break;
        }
        return status;
    }


    /**
     * txCode;//交易类型:DO:消费扣款，RNC:退款
     * @return
     */
    public String getTxCode() {
        if (TextUtils.isEmpty(transStatus)) {
            return "";
        }
        String txCode = "";
        switch (transStatus) {
            case "A":
                txCode = "";
                break;
            case "B":
                if (TextUtils.isEmpty(refundFlag)) {
                    txCode = "DO";
                }
                switch (refundFlag) {
                    case "0":
                        txCode = "DO";
                        break;
                    case "1":
                        txCode = "RNC";
                        break;
                    case "2":
                        txCode = "RNC";
                        break;
                    case "3":
                        txCode = "RNC";
                        break;
                }
                break;
            case "C":
                txCode = "";
                break;
            case "G":
                txCode = "";
                break;
        }
        return txCode;
    }


    public String getTemp1() {
        return temp1;
    }

    public void setTemp1(String temp1) {
        this.temp1 = temp1;
    }

    public String getTemp2() {
        return temp2;
    }

    public void setTemp2(String temp2) {
        this.temp2 = temp2;
    }

    public String getTemp3() {
        return temp3;
    }

    public void setTemp3(String temp3) {
        this.temp3 = temp3;
    }

    public String getTemp4() {
        return temp4;
    }

    public void setTemp4(String temp4) {
        this.temp4 = temp4;
    }

    public String getTemp5() {
        return temp5;
    }

    public void setTemp5(String temp5) {
        this.temp5 = temp5;
    }

    public String getTemp6() {
        return temp6;
    }

    public void setTemp6(String temp6) {
        this.temp6 = temp6;
    }

    public String getTemp7() {
        return temp7;
    }

    public void setTemp7(String temp7) {
        this.temp7 = temp7;
    }

    public String getTemp8() {
        return temp8;
    }

    public void setTemp8(String temp8) {
        this.temp8 = temp8;
    }

    public String getTemp9() {
        return temp9;
    }

    public void setTemp9(String temp9) {
        this.temp9 = temp9;
    }

    public String getTemp10() {
        return temp10;
    }

    public void setTemp10(String temp10) {
        this.temp10 = temp10;
    }

    public String getUploadFlag() {
        return uploadFlag;
    }

    public void setUploadFlag(String uploadFlag) {
        this.uploadFlag = uploadFlag;
    }

    public String getEncodeType() {
        return encodeType;
    }

    public void setEncodeType(String encodeType) {
        this.encodeType = encodeType;
    }

    public String getSign() {
        return sign;
    }

    public void setSign(String sign) {
        this.sign = sign;
    }

    public String getCustomerId() {
        return customerId;
    }

    public void setCustomerId(String customerId) {
        this.customerId = customerId;
    }

    public String getBarcode() {
        return barcode;
    }

    public void setBarcode(String barcode) {
        this.barcode = barcode;
    }

    public String getChannel() {
        return channel;
    }

    public void setChannel(String channel) {
        this.channel = channel;
    }

    public String getBusiType() {
        return busiType;
    }

    public void setBusiType(String busiType) {
        this.busiType = busiType;
    }

    public String getBackUrl() {
        return backUrl;
    }

    public void setBackUrl(String backUrl) {
        this.backUrl = backUrl;
    }

    public String getLedgerDetail() {
        return ledgerDetail;
    }

    public void setLedgerDetail(String ledgerDetail) {
        this.ledgerDetail = ledgerDetail;
    }

    @Override
    public String toString() {
        return "OrderInfo{" +
                "_id=" + _id +
                ", orderNo='" + orderNo + '\'' +
                ", orderReqNo='" + orderReqNo + '\'' +
                ", merchantId='" + merchantId + '\'' +
                ", subMerchantId='" + subMerchantId + '\'' +
                ", orderDate='" + orderDate + '\'' +
                ", orderAmt='" + orderAmt + '\'' +
                ", productAmt='" + productAmt + '\'' +
                ", attachAmt='" + attachAmt + '\'' +
                ", goodsName='" + goodsName + '\'' +
                ", storeId='" + storeId + '\'' +
                ", ourTransNo='" + ourTransNo + '\'' +
                ", errorCode='" + errorCode + '\'' +
                ", errorMsg='" + errorMsg + '\'' +
                ", refundFlag='" + refundFlag + '\'' +
                ", refundReqNo='" + refundReqNo + '\'' +
                ", refundReqDate='" + refundReqDate + '\'' +
                ", transAmt='" + transAmt + '\'' +
                ", transStatus='" + transStatus + '\'' +
                ", encodeType='" + encodeType + '\'' +
                ", sign='" + sign + '\'' +
                ", customerId='" + customerId + '\'' +
                ", barcode='" + barcode + '\'' +
                ", channel='" + channel + '\'' +
                ", busiType='" + busiType + '\'' +
                ", backUrl='" + backUrl + '\'' +
                ", ledgerDetail='" + ledgerDetail + '\'' +
                ", temp1='" + temp1 + '\'' +
                ", temp2='" + temp2 + '\'' +
                ", temp3='" + temp3 + '\'' +
                ", temp4='" + temp4 + '\'' +
                ", temp5='" + temp5 + '\'' +
                ", temp6='" + temp6 + '\'' +
                ", temp7='" + temp7 + '\'' +
                ", temp8='" + temp8 + '\'' +
                ", temp9='" + temp9 + '\'' +
                ", temp10='" + temp10 + '\'' +
                ", uploadFlag='" + uploadFlag + '\'' +
                '}';
    }

    public static OrderInfo buildOrderInfo(OrderInfo info, OrderCreate order) {
        if (info == null || info.getOrderNo() == null)
            info = new OrderInfo();
        if (!TextUtils.isEmpty(order.getMerchantId()))
            info.setMerchantId(order.getMerchantId());
        if (!TextUtils.isEmpty(order.getOrderNo()))
            info.setOrderNo(order.getOrderNo());
        if (!TextUtils.isEmpty(order.getOrderReqNo()))
            info.setOrderReqNo(order.getOrderReqNo());
        if (!TextUtils.isEmpty(order.getOrderDate()))
            info.setOrderDate(order.getOrderDate());
        if (!TextUtils.isEmpty(order.getOurTransNo()))
            info.setOurTransNo(order.getOurTransNo());
        if (!TextUtils.isEmpty(order.getTransAmt()))
            info.setTransAmt(order.getTransAmt());
        if (!TextUtils.isEmpty(order.getEncodeType()))
            info.setEncodeType(order.getEncodeType());
        if (!TextUtils.isEmpty(order.getSign()))
            info.setSign(order.getSign());
        if (!TextUtils.isEmpty(order.getTransStatus()))
            info.setTransStatus(order.getTransStatus());
        return info;
    }

    public static OrderInfo buildOrderInfo(OrderInfo info, OrderCreateRequest order) {
        if (info == null || info.getOrderNo() == null) {
            info = new OrderInfo();
        }
        if (!TextUtils.isEmpty(order.getMerchantId())) {
            info.setMerchantId(order.getMerchantId());
        }
        if (!TextUtils.isEmpty(order.getSubMerchantId())) {
            info.setSubMerchantId(order.getSubMerchantId());
        }
        if (!TextUtils.isEmpty(order.getBarcode())) {
            info.setBarcode(order.getBarcode());
        }
        if (!TextUtils.isEmpty(order.getOrderNo())) {
            info.setOrderNo(order.getOrderNo());
        }
        if (!TextUtils.isEmpty(order.getOrderReqNo())) {
            info.setOrderReqNo(order.getOrderReqNo());
        }
        if (!TextUtils.isEmpty(order.getChannel())) {
            info.setChannel(order.getChannel());
        }
        if (!TextUtils.isEmpty(order.getBusiType())) {
            info.setBusiType(order.getBusiType());
        }
        if (!TextUtils.isEmpty(order.getOrderDate())) {
            info.setOrderDate(order.getOrderDate());
        }
        if (!TextUtils.isEmpty(order.getOrderAmt())) {
            info.setOrderAmt(order.getOrderAmt());
        }
        if (!TextUtils.isEmpty(order.getProductAmt())) {
            info.setProductAmt(order.getProductAmt());
        }
        if (!TextUtils.isEmpty(order.getAttachAmt())) {
            info.setAttachAmt(order.getAttachAmt());
        }
        if (!TextUtils.isEmpty(order.getGoodsName())) {
            info.setGoodsName(order.getGoodsName());
        }
        if (!TextUtils.isEmpty(order.getStoreId())) {
            info.setStoreId(order.getStoreId());
        }
        if (!TextUtils.isEmpty(order.getBackUrl())) {
            info.setBackUrl(order.getBackUrl());
        }
        if (!TextUtils.isEmpty(order.getLedgerDetail())) {
            info.setLedgerDetail(order.getLedgerDetail());
        }
        return info;
    }

    public static OrderInfo buildOrderInfo(OrderInfo info, OrderQuery order) {
        if (info == null || info.getOrderNo() == null) {
            info = new OrderInfo();
        }
        if (!TextUtils.isEmpty(order.getTransStatus())) {
            info.setTransStatus(order.getTransStatus());
        }
        if (!TextUtils.isEmpty(order.getOurTransNo())) {
            info.setOurTransNo(order.getOurTransNo());
        }
        if (!TextUtils.isEmpty(order.getEncodeType())) {
            info.setEncodeType(order.getEncodeType());
        }
        if (!TextUtils.isEmpty(order.getSign())) {
            info.setSign(order.getSign());
        }
        if (!TextUtils.isEmpty(order.getRefundFlag())) {
            info.setRefundFlag(order.getRefundFlag());
        }
        if (!TextUtils.isEmpty(order.getCustomerId())) {
            info.setCustomerId(order.getCustomerId());
        }
        if (!TextUtils.isEmpty(order.getMerchantId())) {
            info.setMerchantId(order.getMerchantId());
        }
        if (!TextUtils.isEmpty(order.getOrderNo())) {
            info.setOrderNo(order.getOrderNo());
        }
        if (!TextUtils.isEmpty(order.getOrderReqNo())) {
            info.setOrderReqNo(order.getOrderReqNo());
        }
        if (!TextUtils.isEmpty(order.getOrderDate())) {
            info.setOrderDate(order.getOrderDate());
        }
        if (!TextUtils.isEmpty(order.getTransAmt())) {
            info.setTransAmt(order.getTransAmt());
        }
        return info;
    }

    public static OrderInfo buildOrderInfo(OrderInfo info, OrderRefundRequest order) {
        if (info == null || info.getOrderNo() == null) {
            info = new OrderInfo();
        }
//        if (!TextUtils.isEmpty(order.getMerchantPwd())) {
//            info.setMerchantPwd(order.getMerchantPwd());
//        }
        if (!TextUtils.isEmpty(order.getRefundReqNo())) {
            info.setRefundReqNo(order.getRefundReqNo());
        }
        if (!TextUtils.isEmpty(order.getRefundReqDate())) {
            info.setRefundReqDate(order.getRefundReqDate());
        }
        if (!TextUtils.isEmpty(order.getTransAmt())) {
            info.setTransAmt(order.getTransAmt());
        }
        return info;
    }

    public static OrderInfo buildOrderInfo(OrderInfo info, OrderReverseRequest order) {
        if (info == null || info.getOrderNo() == null) {
            info = new OrderInfo();
        }
//        if (!TextUtils.isEmpty(order.getMerchantPwd())) {
//            info.setMerchantPwd(order.getMerchantPwd());
//        }
        if (!TextUtils.isEmpty(order.getRefundReqNo())) {
            info.setRefundReqNo(order.getRefundReqNo());
        }
        if (!TextUtils.isEmpty(order.getRefundReqDate())) {
            info.setRefundReqDate(order.getRefundReqDate());
        }
        if (!TextUtils.isEmpty(order.getTransAmt())) {
            info.setTransAmt(order.getTransAmt());
        }
        return info;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeInt(this._id);
        dest.writeString(this.orderNo);
        dest.writeString(this.orderReqNo);
        dest.writeString(this.merchantId);
        dest.writeString(this.subMerchantId);
        dest.writeString(this.orderDate);
        dest.writeString(this.orderAmt);
        dest.writeString(this.productAmt);
        dest.writeString(this.attachAmt);
        dest.writeString(this.goodsName);
        dest.writeString(this.storeId);
        dest.writeString(this.ourTransNo);
        dest.writeString(this.errorCode);
        dest.writeString(this.errorMsg);
        dest.writeString(this.refundFlag);
        dest.writeString(this.refundReqNo);
        dest.writeString(this.refundReqDate);
        dest.writeString(this.transAmt);
        dest.writeString(this.transStatus);
        dest.writeString(this.encodeType);
        dest.writeString(this.sign);
        dest.writeString(this.customerId);
        dest.writeString(this.barcode);
        dest.writeString(this.channel);
        dest.writeString(this.busiType);
        dest.writeString(this.backUrl);
        dest.writeString(this.ledgerDetail);
        dest.writeString(this.temp1);
        dest.writeString(this.temp2);
        dest.writeString(this.temp3);
        dest.writeString(this.temp4);
        dest.writeString(this.temp5);
        dest.writeString(this.temp6);
        dest.writeString(this.temp7);
        dest.writeString(this.temp8);
        dest.writeString(this.temp9);
        dest.writeString(this.temp10);
        dest.writeString(this.uploadFlag);
    }

    public OrderInfo() {
    }

    protected OrderInfo(Parcel in) {
        this._id = in.readInt();
        this.orderNo = in.readString();
        this.orderReqNo = in.readString();
        this.merchantId = in.readString();
        this.subMerchantId = in.readString();
        this.orderDate = in.readString();
        this.orderAmt = in.readString();
        this.productAmt = in.readString();
        this.attachAmt = in.readString();
        this.goodsName = in.readString();
        this.storeId = in.readString();
        this.ourTransNo = in.readString();
        this.errorCode = in.readString();
        this.errorMsg = in.readString();
        this.refundFlag = in.readString();
        this.refundReqNo = in.readString();
        this.refundReqDate = in.readString();
        this.transAmt = in.readString();
        this.transStatus = in.readString();
        this.encodeType = in.readString();
        this.sign = in.readString();
        this.customerId = in.readString();
        this.barcode = in.readString();
        this.channel = in.readString();
        this.busiType = in.readString();
        this.backUrl = in.readString();
        this.ledgerDetail = in.readString();
        this.temp1 = in.readString();
        this.temp2 = in.readString();
        this.temp3 = in.readString();
        this.temp4 = in.readString();
        this.temp5 = in.readString();
        this.temp6 = in.readString();
        this.temp7 = in.readString();
        this.temp8 = in.readString();
        this.temp9 = in.readString();
        this.temp10 = in.readString();
        this.uploadFlag = in.readString();
    }

    public static final Parcelable.Creator<OrderInfo> CREATOR = new Parcelable.Creator<OrderInfo>() {
        public OrderInfo createFromParcel(Parcel source) {
            return new OrderInfo(source);
        }

        public OrderInfo[] newArray(int size) {
            return new OrderInfo[size];
        }
    };

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        OrderInfo orderInfo = (OrderInfo) o;

        if (_id != orderInfo._id) return false;
        if (orderNo != null ? !orderNo.equals(orderInfo.orderNo) : orderInfo.orderNo != null)
            return false;
        if (orderReqNo != null ? !orderReqNo.equals(orderInfo.orderReqNo) : orderInfo.orderReqNo != null)
            return false;
        if (merchantId != null ? !merchantId.equals(orderInfo.merchantId) : orderInfo.merchantId != null)
            return false;
        if (subMerchantId != null ? !subMerchantId.equals(orderInfo.subMerchantId) : orderInfo.subMerchantId != null)
            return false;
        if (orderDate != null ? !orderDate.equals(orderInfo.orderDate) : orderInfo.orderDate != null)
            return false;
        if (orderAmt != null ? !orderAmt.equals(orderInfo.orderAmt) : orderInfo.orderAmt != null)
            return false;
        if (productAmt != null ? !productAmt.equals(orderInfo.productAmt) : orderInfo.productAmt != null)
            return false;
        if (attachAmt != null ? !attachAmt.equals(orderInfo.attachAmt) : orderInfo.attachAmt != null)
            return false;
        if (goodsName != null ? !goodsName.equals(orderInfo.goodsName) : orderInfo.goodsName != null)
            return false;
        if (storeId != null ? !storeId.equals(orderInfo.storeId) : orderInfo.storeId != null)
            return false;
        if (ourTransNo != null ? !ourTransNo.equals(orderInfo.ourTransNo) : orderInfo.ourTransNo != null)
            return false;
        if (errorCode != null ? !errorCode.equals(orderInfo.errorCode) : orderInfo.errorCode != null)
            return false;
        if (errorMsg != null ? !errorMsg.equals(orderInfo.errorMsg) : orderInfo.errorMsg != null)
            return false;
        if (refundFlag != null ? !refundFlag.equals(orderInfo.refundFlag) : orderInfo.refundFlag != null)
            return false;
        if (refundReqNo != null ? !refundReqNo.equals(orderInfo.refundReqNo) : orderInfo.refundReqNo != null)
            return false;
        if (refundReqDate != null ? !refundReqDate.equals(orderInfo.refundReqDate) : orderInfo.refundReqDate != null)
            return false;
        if (transAmt != null ? !transAmt.equals(orderInfo.transAmt) : orderInfo.transAmt != null)
            return false;
        if (transStatus != null ? !transStatus.equals(orderInfo.transStatus) : orderInfo.transStatus != null)
            return false;
        if (encodeType != null ? !encodeType.equals(orderInfo.encodeType) : orderInfo.encodeType != null)
            return false;
        if (sign != null ? !sign.equals(orderInfo.sign) : orderInfo.sign != null) return false;
        if (customerId != null ? !customerId.equals(orderInfo.customerId) : orderInfo.customerId != null)
            return false;
        if (barcode != null ? !barcode.equals(orderInfo.barcode) : orderInfo.barcode != null)
            return false;
        if (channel != null ? !channel.equals(orderInfo.channel) : orderInfo.channel != null)
            return false;
        if (busiType != null ? !busiType.equals(orderInfo.busiType) : orderInfo.busiType != null)
            return false;
        if (backUrl != null ? !backUrl.equals(orderInfo.backUrl) : orderInfo.backUrl != null)
            return false;
        if (ledgerDetail != null ? !ledgerDetail.equals(orderInfo.ledgerDetail) : orderInfo.ledgerDetail != null)
            return false;
        if (temp1 != null ? !temp1.equals(orderInfo.temp1) : orderInfo.temp1 != null) return false;
        if (temp2 != null ? !temp2.equals(orderInfo.temp2) : orderInfo.temp2 != null) return false;
        if (temp3 != null ? !temp3.equals(orderInfo.temp3) : orderInfo.temp3 != null) return false;
        if (temp4 != null ? !temp4.equals(orderInfo.temp4) : orderInfo.temp4 != null) return false;
        if (temp5 != null ? !temp5.equals(orderInfo.temp5) : orderInfo.temp5 != null) return false;
        if (temp6 != null ? !temp6.equals(orderInfo.temp6) : orderInfo.temp6 != null) return false;
        if (temp7 != null ? !temp7.equals(orderInfo.temp7) : orderInfo.temp7 != null) return false;
        if (temp8 != null ? !temp8.equals(orderInfo.temp8) : orderInfo.temp8 != null) return false;
        if (temp9 != null ? !temp9.equals(orderInfo.temp9) : orderInfo.temp9 != null) return false;
        if (temp10 != null ? !temp10.equals(orderInfo.temp10) : orderInfo.temp10 != null)
            return false;
        return !(uploadFlag != null ? !uploadFlag.equals(orderInfo.uploadFlag) : orderInfo.uploadFlag != null);
    }

    @Override
    public OrderInfo clone() {
        OrderInfo o = null;
        try {
            o = (OrderInfo) super.clone();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return o;
    }
}
